<template>
<h1>El-表单组件</h1>
  <el-form style="width: 500px;margin: 0 auto;" label-width="80" v-model="user">
    <el-form-item label="用户名">
      <el-input placeholder="请输入用户名" v-model="user.name"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input placeholder="请输入密码"v-model="user.password"></el-input>
    </el-form-item>
    <el-form-item label="性别" >
      <el-radio-group v-model="user.gender">
        <el-radio value="男" label="男"></el-radio>
        <el-radio value="女" label="女"></el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="所在地">
      <el-select style="width: 50%;" placeholder="请选择城市" v-model="user.city">
        <el-option label="北京" value="bj"></el-option>
        <el-option label="长春" value="cc"></el-option>
        <el-option label="武汉" value="wh"></el-option>
        <el-option label="郑州" value="zz"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="管理员">
      <el-switch v-model="user.isAdmin"></el-switch>
    </el-form-item>
    <el-form-item>
      <el-button type="success" @click="show">点我提交</el-button>
    </el-form-item>

  </el-form>
</template>
<script setup>
import {ref} from "vue";
const user = ref({
  name:'',
  password:'',
  gender:'',
  city:'',
  isAdmin:false
})
const show = () => {
  console.log(user.value)
}
</script>


<style scoped>

</style>